//
//  LBGreyscaleFilter.mm
//  OpenGLGame
//
//  Created by Nguyen Cong Huy on 11/22/12.
//  Copyright (c) 2012 UIT. All rights reserved.
//

#include <iostream>
#include "LBGreyscaleFilter.h"

char fShaderStrGreyscale[] = ""
"precision highp float;"

"varying vec2 vtexCoor;"

"uniform sampler2D texture;"

"const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);"

"void main()"
"{"
"    lowp vec4 textureColor = texture2D(texture, vtexCoor);"
"    float luminance = dot(textureColor.rgb, W);"
    
"    gl_FragColor = vec4(vec3(luminance), textureColor.a);"
"}";

LBGreyscaleFilter::LBGreyscaleFilter(){
    init(0, fShaderStrGreyscale);
}